import request from '@/utils/request'

export function getPermissions(providerName, providerKey) {
  return request({
    url: '/api/permission-management/permissions',
    method: 'get',
    params: { providerName, providerKey }
  })
}

export function updatePermissions(providerName, providerKey, data) {
  return request({
    url: '/api/permission-management/permissions',
    method: 'put',
    params: { providerName, providerKey },
    data
  })
}

export function getGroupPermissions(group_id) {
  return request({
    url: `/api/identity/permissions/group/${group_id}/`,
    method: 'get'
  })
}

export function updateGroupPermissions(group_id, data) {
  return request({
    url: `/api/identity/permissions/group/${group_id}/`,
    method: 'put',
    data
  })
}

export function getUserPermissions(user_id) {
  return request({
    url: `/api/identity/permissions/user/${user_id}/`,
    method: 'get'
  })
}

export function updateUserPermissions(user_id, data) {
  return request({
    url: `/api/identity/permissions/user/${user_id}/`,
    method: 'put',
    data
  })
}

